package club.banyuan;

public class Bus extends Vehicle {
    // 载客量
    private int passengers;

    public int getPassengers() {
        return passengers;
    }

    public void setPassengers(int passengers) {
        this.passengers = passengers;
    }

    public Bus(int year, String factory, boolean isRent, int passengers) {
        super(year, factory, isRent);
        this.passengers = passengers;
    }

    @Override
    public String toString() {
        if (this.isRent())
            return this.getYear() + "年" + this.getFactory() + "客车，载客量" + passengers + "座,已出租。";
        else {
            return this.getYear() + "年" + this.getFactory() + "客车，载客量" + passengers + "座,未出租。";
        }
    }
}
